package com.april.controller;

import com.april.feign.ItemFeign;
import com.april.pojo.TbItemParam;
import com.april.utils.Result;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: 槐序 廿一
 * @Date: 2023-06-19
 * @Time: 20:48
 * @Description:
 */
@RestController
@RequestMapping("backend")
public class ItemParamController {

    @Resource
    ItemFeign itemFeign;

    @RequestMapping("itemParam/selectItemParamByItemCatId/{itemCatId}")
    public Result selectItemParamByItemCatId(@PathVariable(value = "itemCatId") Long itemCatId) {
        TbItemParam tbItemParam = itemFeign.selectItemParamByItemCatId(itemCatId);
        if (tbItemParam == null) {
            return Result.error("查询商品规格模板失败");
        }
        return Result.ok(tbItemParam);
    }
}
